/**
 * [442] 数组中重复的数据
 *
 * @format
 * @lc app=leetcode.cn id=442 lang=javascript
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var findDuplicates = function (nums) {
    const dist = {}
    const result = []
    nums.forEach((e) => (dist[e] ? result.push(e) : (dist[e] = true)))
    return result
}
// @lc code=end
